<?php
namespace app\index\controller;

use app\common\model\Chat;
use app\common\model\Info;
use app\common\model\Qqjob;
use app\common\model\Qqs;
use app\common\model\Gg;
use app\common\model\Users;
use app\common\model\Weblist;
class MobileAjax extends Ajax
{
    private $loginapi = '';
    private $ua = 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36';
    private $trace_x;
    private $trace_y;
    private $trace_time;
    private $tokenid;

    public function setLoginApi($url)
    {
        $this->loginapi = $url;
    }

   public function qq($act)
    {
        switch ($act) {
			case 'del':
					$data = input('post.qid');
                    $del_res = Qqs::delbyqid($data);
                    Qqjob::where('qid', '=', $data)->delete();
                    if ($del_res) {
                        $result = '<script>x.msg(\'删除成功\');x.mclose(moid["qqset"]);x.html(\''.url('mobile/qqlist',['act'=>'info']).'\');</script>';
                    } else {
                        $result = '<script>x.msg(\'删除失败\');</script>';
                    }
                break;
			case 'save':
                    $data = input('post.');
					$data['sid']='1';
					$data['type']='1';
                    $add = Qqs::madd($data, $this->userInfo);
					$result = '<script>x.mclose(moid["qqset"]);x.html(\'/mobile/qqlist/act/info.html\');sm.cleartime();x.msg(\''.$add['message'].'\');</script>';
                break;
			case 'saoma':
					$data = input('post.');
					if(!input('area'))$result = '<script>x.msg(\'请选择服务器\');</script>';
					if(config('sys_is_qqlogin_api_check_'.input('area'))==NULL){
						$result = '<script>x.mclose();sm.cleartime();x.msg(\'登陆服务器不存在\');</script>';
					}elseif(config('sys_is_qqlogin_api_check_'.input('area'))==0){
						$result = '<script>x.mclose();sm.cleartime();x.msg(\'登陆服务器未开启\');</script>';
					}else{
						$api = config('sys_is_qqlogin_api_url_'.input('area'));
						if(input('get.is')){
							$data=[
							];
							$send=json_decode(send_get($api.'?do=getqrpic',$data),true);
							$result = '<script>sm.img("'.$send['qrsig'].'","","'.$send['data'].'");</script>';
						}else{
							$qrsig = input('post.qrsig');
							$check=json_decode(send_get($api.'?do=qrlogin&qrsig='.$qrsig),true);
							if($check['saveOK']==0){
								$data = [
									'qq' => $check['uin'],
									'area'	=> input('area'),
									'pwd' => '',
									'type'	=>	'0',
									'skey' => '@' . $check['skey'],
									'pskey' => $check['pskey'],
									'superkey' => $check['superkey'],
								];
								$json = Qqs::madd($data, $this->userInfo);
								$qdt = Qqs::where('qq', '=', $check['uin'])->find();
								$result = "<script>x.mclose();x.msg('".$json['message']."');sm.cleartime();x.mclose(moid[\"qqlist_add\"]);qqlist.callback(1,1,1);qqlist.html();qqset_mode_load();</script>";
							}elseif($check['saveOK']==1){
								$result = '<script>x.mclose();x.msg(\''.$json['message'].'\');sm.cleartime();x.mclose(moid["qqlist_add"]);qqset_mode_load();</script>';
							}elseif($check['saveOK']==2){
								$result = '<script></script>';
							}elseif($check['saveOK']==3){
								$result = '<script>_sm_success();</script>';
							}elseif($check['saveOK']==6){
								$result = '<script>x.mclose();sm.cleartime();x.mclose(moid["qqlist_add"]);x.msg(\'登陆成功,获取QQ信息失败,请稍后重试\');</script>';
							}else{
								$result = '<script>'.$check['msg'].'</script>';
							}
						}
					}
				break;
		}
        echo $result;
    }
	
	private function getuin($uin)
    {
        for ($i = 0; $i < strlen($uin); $i++) {
            if ($uin[$i] == 'o' || $uin[$i] == '0') continue;
            else break;
        }
        return substr($uin, $i);
    }

    private function getqrtoken($qrsig)
    {
        $len = strlen($qrsig);
        $hash = 0;
        for ($i = 0; $i < $len; $i++) {
            $hash += (($hash << 5) & 2147483647) + ord($qrsig[$i]) & 2147483647;
            $hash &= 2147483647;
        }
        return $hash & 2147483647;
    }

    private function captcha($imgAurl, $imgBurl)
    {
        $imgA = imagecreatefromjpeg($imgAurl);
        $imgB = imagecreatefromjpeg($imgBurl);
        $imgWidth = imagesx($imgA);
        $imgHeight = imagesy($imgA);

        $t = 0;
        $r = 0;
        for ($y = 20; $y < $imgHeight - 20; $y++) {
            for ($x = 20; $x < $imgWidth - 20; $x++) {
                $rgbA = imagecolorat($imgA, $x, $y);
                $rgbB = imagecolorat($imgB, $x, $y);
                if (abs($rgbA - $rgbB) > 1800000) {
                    $t++;
                    $r += $x;
                }
            }
        }
        return round($r / $t) - 55;
    }

    private function getcdata($ans, $M, $randstr)
    {
        for ($r = 0; $r < $M && $r < 1000; $r++) {
            $c = $randstr . $r;
            $d = md5($c);
            if ($ans == $d) {
                $a = $r;
                break;
            }
        }
        return $a;
    }

    private function generate_slideValue($width)
    {
        $sx = rand(700, 730);
        $sy = rand(295, 300);
        $this->trace_x = $sx;
        $this->trace_y = $sy;
        $ex = $sx + intval(($width - 55) / 2);
        $stime = rand(100, 300);
        $res = '[' . $sx . ',' . $sy . ',' . $stime . '],';
        while ($sx < $ex) {
            $x = rand(1, 5);
            $sx += $x;
            $y = 0;
            $time = rand(9, 16);
            $stime += $time;
            $res .= '[' . $x . ',' . $y . ',' . $time . '],';
        }
        $res = substr($res, 0, -1);
        return $res;
    }

    private function generate_mousemove($width)
    {
        $sx = rand(720, 810);
        $sy = rand(270, 290);
        $stime = rand(800, 1000);
        $res = '[' . $sx . ',' . $sy . ',' . $stime . '],';
        while ($sx > $this->trace_x || $sy < $this->trace_y) {
            if ($sx > $this->trace_x) $x = rand(-5, -1);
            else $x = 0;
            if ($sy < $this->trace_y) $y = rand(1, 2);
            else $y = 0;
            $sx += $x;
            $sy += $y;
            $time = rand(9, 16);
            $stime += $time;
            $res .= '[' . $x . ',' . $y . ',' . $time . '],';
        }
        $ex = $this->trace_x + intval(($width - 55) / 2);
        while ($sx < $ex) {
            $x = rand(1, 5);
            $sx += $x;
            $y = 0;
            $time = rand(9, 16);
            $stime += $time;
            $res .= '[' . $x . ',' . $y . ',' . $time . '],';
        }
        $res = substr($res, 0, -1);
        $this->trace_time = ceil($stime / 1000);
        $this->trace_x = $sx;
        $this->trace_y = $sy;
        return $res;
    }

    public function getcollect($width)
    {
        $begintime = time();
        $this->tokenid = $this->randNumber(10);
        $ip = '10.9.' . rand(10, 150) . '.' . rand(10, 150);
        $slideValue = $this->generate_slideValue($width);
        $mousemove = $this->generate_mousemove($width);
        $endtime = $begintime + $this->trace_time;
        $string = '{"mouseclick":[],"keyvalue":[],"user_Agent":"' . $this->ua . '","resolutionx":1920,"resolutiony":1080,"winSize":[1600,522],"url":"https://ssl.captcha.qq.com/cap_union_new_show","refer":"https://ui.ptlogin2.qq.com/cgi-bin/login","begintime":' . $begintime . ',"endtime":' . $endtime . ',"platform":1,"os":"other","keyboards":0,"flash":1,"pluginNum":22,"index":1,"ptcz":"","tokenid":' . $this->tokenid . ',"a":' . $this->tokenid . ',"btokenid":null,"tokents":' . $begintime . ',"ips":{"in":["' . $ip . '"]},"colorDepth":24,"cookieEnabled":true,"timezone":8,"wDelta":0,"mousemove":[' . $mousemove . '],"keyUpCnt":0,"keyUpValue":[],"mouseUpValue":[{"t":' . $this->trace_time . ',"x":' . $this->trace_x . ',"y":' . $this->trace_y . '}],"mouseUpCnt":1,"mouseDownValue":[],"mouseDownCnt":0,"orientation":[{"x":0,"y":0,"z":0}],"bSimutor":0,"focusBlur":{"in":[],"out":[],"t":[]},"fVersion":27,"charSet":"UTF-8","resizeCnt":0,"errors":[],"screenInfo":"1920-1080-1042-24-*-*-*","elapsed":1000,"ft":"6f_7P_n_H","clientType":"1","coordinate":[654,102,0.4294],"trycnt":1,"refreshcnt":0,"slideValue":[' . $slideValue . '],"dragobj":0}';
        return $this->aes_encrypt($string);
    }

    private function aes_encrypt($data)
    {
        $secret_key = '0123456789abcdef';
        $iv = '0123456789abcdef';
        if (function_exists("openssl_encrypt")) {
            return openssl_encrypt($data, 'aes-128-cbc', $secret_key, false, $iv);
        } else {
            return $this->get_curl('http://music.api.cccyun.cc/aes.php', array('data' => $data));
        }
    }

    private function randNumber($length)
    {
        $str = '123456789';
        $len = strlen($str) - 1;
        $randstr = '';
        for ($i = 0; $i < $length; $i++) {
            $num = mt_rand(0, $len);
            $randstr .= $str[$num];
        }
        return $randstr;
    }

    private function get_curl($url, $post = 0, $referer = 0, $cookie = 0, $header = 0, $ua = 0, $nobaody = 0)
    {
        if ($this->loginapi) return $this->get_curl_proxy($url, $post, $referer, $cookie, $header, $ua, $nobaody);
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, $url);
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
        curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
        $httpheader[] = "Accept: application/json";
        $httpheader[] = "Accept-Encoding: gzip,deflate,sdch";
        $httpheader[] = "Accept-Language: zh-CN,zh;q=0.8";
        $httpheader[] = "Connection: keep-alive";
        curl_setopt($ch, CURLOPT_HTTPHEADER, $httpheader);
        if ($post) {
            curl_setopt($ch, CURLOPT_POST, 1);
            curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
        }
        if ($header) {
            curl_setopt($ch, CURLOPT_HEADER, TRUE);
        }
        if ($cookie) {
            curl_setopt($ch, CURLOPT_COOKIE, $cookie);
        }
        if ($referer) {
            curl_setopt($ch, CURLOPT_REFERER, $referer);
        }
        if ($ua) {
            curl_setopt($ch, CURLOPT_USERAGENT, $ua);
        } else {
            curl_setopt($ch, CURLOPT_USERAGENT, $this->ua);
        }
        if ($nobaody) {
            curl_setopt($ch, CURLOPT_NOBODY, 1);

        }
        curl_setopt($ch, CURLOPT_TIMEOUT, 10);
        curl_setopt($ch, CURLOPT_ENCODING, "gzip");
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        $ret = curl_exec($ch);
        curl_close($ch);
        return $ret;
    }

    private function get_curl_split($url)
    {
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, $url);
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
        curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
        $httpheader[] = "Accept: */*";
        $httpheader[] = "Accept-Encoding: gzip,deflate,sdch";
        $httpheader[] = "Accept-Language: zh-CN,zh;q=0.8";
        $httpheader[] = "Connection: keep-alive";
        curl_setopt($ch, CURLOPT_HTTPHEADER, $httpheader);
        curl_setopt($ch, CURLOPT_HEADER, TRUE);
        curl_setopt($ch, CURLOPT_USERAGENT, $this->ua);
        curl_setopt($ch, CURLOPT_TIMEOUT, 10);
        curl_setopt($ch, CURLOPT_ENCODING, "gzip");
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        $ret = curl_exec($ch);
        $headerSize = curl_getinfo($ch, CURLINFO_HEADER_SIZE);
        $header = substr($ret, 0, $headerSize);
        $body = substr($ret, $headerSize);
        $ret = array();
        $ret['header'] = $header;
        $ret['body'] = $body;
        curl_close($ch);
        return $ret;
    }

    private function get_curl_proxy($url, $post = 0, $referer = 0, $cookie = 0, $header = 0, $ua = 0, $nobaody = 0)
    {
        $data = array('url' => $url, 'post' => $post, 'referer' => $referer, 'cookie' => $cookie, 'header' => $header, 'ua' => $ua, 'nobaody' => $nobaody);
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
        curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
        curl_setopt($ch, CURLOPT_URL, $this->loginapi);
        curl_setopt($ch, CURLOPT_POST, 1);
        curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
        curl_setopt($ch, CURLOPT_TIMEOUT, 10);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        $ret = curl_exec($ch);
        curl_close($ch);
        return $ret;
    }
	
	public function other($act)
    {
        if (request()->isAjax()) {
            switch ($act) {
				case 'mzrz':
					$qq = input('qq');
                $where['start'] = ['<>', 0];
                $row = Qqjob::where([
                    'qq' => $qq,
                    'cookiezt' => 0
                ])
                    ->where($where)
                    ->find();
                $user = Users::where('uid', '=', $row['uid'])
                    ->find();
                if (empty($qq)) {
                    echo '请输入QQ号';
                } elseif ($row) {
                    if ($row['server'] == 1) {
                        $server = '免费服务器';
                        $sd = config('sys_server_sd');
                    } elseif ($row['server'] == 2) {
                        $server = 'VIP服务器';
                        $sd = config('sys_vid_server_sd');
                    } else {
                        $server = '急速服务器';
                        $sd = config('sys_js_server_sd');
                    }
					echo '<script>x.getval("#mzrzqq",null);$("#mzrzinquiryresult").html(\'<div class="w67 p3 m4 bg-bai dl2 b b-hui rx4"><div class="f8 hei"><img class="w9 h9 b b-hui r5 mr4" src="//q1.qlogo.cn/g?b=qq&nk=' . $qq . '&s=100&t=327">' . get_qqnick($qq) . '</div><div class="mt4"><font class="hui">秒赞 QQ ： </font><font class="bold dzi">' . $qq . '</font></div><div class="mt2"><font class="hui">秒赞状态 ：</font><font class="bold lv">已开启 - '.$server.'</font></div><div class="mt2"><font class="hui">秒赞会员 ：</font>' . is_Vip($user['viptime']) . '<span class="ml2"><font color="red"></font></span></div><div class="mt2"><font class="hui">底赞数量 ：</font><span class="bold cheng">' . mt_rand(50, 600) . '</span></div><div class="mt5 hui">查询时间 ：' . $this->date . '</div><div class="mt2 f3 hui">'.config('web_webname').'（'.$_SERVER['HTTP_HOST'].'）为您的秒赞保驾护航</div></div> \');</script>';
                } else {
                    echo '<script>x.getval("#mzrzqq",null);$("#mzrzinquiryresult").html(\'<div class="w67 p3 m4 bg-bai dl2 b b-hui rx4"><div class="f8 hei"><img class="w9 h9 b b-hui r5 mr4" src="//q1.qlogo.cn/g?b=qq&nk=' . $qq . '&s=100&t=327"> No</div><div class="mt4"><font class="hui">查询 QQ ：</font><font class="bold dzi">' . $qq . '</font></div><div class="mt2"><font class="hui">秒赞状态 ：</font><font class="bold">未开启</font></div><div class="mt2"><font class="hui">秒赞信息 ：</font>尚未在'.config('web_webname').'开启秒赞功能</div><div class="mt5 hui">查询时间 ：2020-03-27 21:07:21</div><div class="mt2 f3 hui">'.config('web_webname').'（'.$_SERVER['HTTP_HOST'].'）为您的秒赞保驾护航</div></div> \');</script>';
                }
				break;
				case 'dlyz':
				$uin = input('post.qq');
				$check=Users::dlyz($uin);
				if($check['code']==0){
					echo '<script>x.getval("#dailiqq",null);$("#dlyzinquiryresult").html(\'<p class="f6 bold">查询结果：</p><br><p class="lv">该QQ('.$uin.')通过了'.config('web_webname').'的代理验证，可放心交易。</p>\');</script>';
				}else{
					echo '<script>x.getval("#dailiqq",null);$("#dlyzinquiryresult").html(\'<p class="f6 bold">查询结果：</p><br><p class="hong">该QQ('.$uin.')不是'.config('web_webname').'的代理，请结束交易。</p>\');</script>';
				}
				break;
			case 'mzq':
                $type = input('get.type');
                $load_list = Qqjob::
                where('server', '=', $type)
                    ->where('type', '=', 'zan')
                    ->order('lasttime desc')
                    ->limit(200)
                    ->select();
                if ($load_list) {
                    foreach ($load_list as $qq) {
						$qq_row = Qqs::where(['qq' => $qq['qq']])->find();
						$mzcount= Qqjob::QqMzNum($qq['qq']);
						if ($is_zan = is_zan($qq)) {
							if ($is_zan == '秒赞运行中') {
								$color = 'lv';
							} else {
								$color = 'hong';
							}
						}
                        echo ' <dl class="h12 in" onclick="mzq_mode_footer(\'' . $qq['qq'] . '\');">
                            <dt><img class="w7 h7 r5 b b2 ml2 mr2"
                                     src="//q1.qlogo.cn/g?b=qq&nk=' . $qq['qq'] . '&s=40&t=3046"></dt>
                            <dt><p class="w15 f2 hui nowrap">'.get_qqnick($qq['qq']).'</p>
                                <p class="w19 dzi">' . $qq['qq'] . '</p></dt>
                            <dt><p class="f2"><i class="icon icon-appreciate hui mr1"></i> <font class="'.$color.'">'.$is_zan.'</font>
                            </p>
                                <p class="f2 hui"><i class="icon icon-time mr1"></i> ' . $qq_row['time'] . '</p></dt>
                            <dd class="pl3 pr3 f2 hui t-r"><p>已秒赞：'.$mzcount.'次</p></dd>
                        </dl>';
                    }
                }
                break;
			}
		}
	}
	
	public function Gnset($act)
    {
        if (request()->isAjax()) {
            switch ($act) {
				case 'delete':
                    $qid = input('post.qid');
                    $type = input('post.xm');
                    $cylb = cylb_Name($type);
                    if (!Qqjob::where(['qid' => $qid, 'type' => $type,'zid' => WEB_ID])->find()) {
                        echo '<script>x.msg(\'删除成功\');$(\'#is'.$type.'\').remove();</script>';
                    } else {
                        Qqjob::where('qid', '=', $qid)
                            ->where('type', '=', $type)
                            ->delete();
                        echo '<script>x.msg(\'删除成功\');$(\'#is'.$type.'\').remove();</script>';
                    }
                    break;
                case 'add':
                    $qid = input('post.qid');
                    $uin = input('post.uin');
                    $type = input('post.type');
                    $id = input('post.gnid');
                    $cylb = cylb_Name($type);
                    if (Qqjob::where(['qid' => $qid, 'type' => $type, 'zid' => WEB_ID])->find()) {
                        echo '<script>x.msg(\'添加成功\');</script>';
                    } else {
                        Qqjob::insert([
                            'zid' => WEB_ID,
                            'uid' => $this->userInfo['uid'],
                            'qid' => $qid,
                            'qq' => $uin,
                            'type' => $type,
                            'gnid' => $id,
                            'ph' => $cylb['id'],
                            'lasttime' => '01-01 00:00:00'
                        ]);
                        echo '<script>x.msg(\'添加成功\');$(".'.$type.'access").html("已添加");qqset_mode_load();</script>';
                    }
                    break;
                case 'zan':
                    $data = input('post.');
                    $diff = timediff(strtotime($this->userInfo['vipstart']), strtotime($this->userInfo['viptime']));
                    if ($data['iszt'] == 2 && $this->userInfo['vipstart'] == '') {
                        echo '<script>
							layer.open({
								content: \'<h4 class="mt0 mb4">系统提示</h4><p>您需要开通秒赞会员才可以使用VIP服务器</p>\',
								btn: \'我 知 道 了\',
								shadeClose: false,
								yes: function(i){
									x.mclose(i);
									mode_shop_vip();
									
								},
								no: function(i){
									x.mclose(i);
									
									
								}
							});
							</script>';
                    } elseif ($data['iszt'] == 3 && $diff < 89) {
                        echo '<script>
							layer.open({
								content: \'<h4 class="mt0 mb4">系统提示</h4><p>您需要开通秒赞包季会员才可以使用急速服务器</p>\',
								btn: \'我 知 道 了\',
								shadeClose: false,
								yes: function(i){
									x.mclose(i);
									mode_shop_vip();
									
								},
								no: function(i){
									x.mclose(i);
									
									
								}
							});
							</script>';
                    } else {
                        $update = [
                            'server' => $data['iszt'],
                            'start' => $data['is'],
                            'xy' => 1,
                            'mode' => $data['mode'],
                            'list' => $data['qqlist'],
                            'nexttime' => time(),
                            'date' => date('m-d H:i:s')
                        ];
                        Qqjob::
                        where('qid', '=', $data['qid'])
                            ->where('type', '=', $act)
                            ->update($update);
						if ($data['is'] == 1) {
							echo '<script>x.mclose();x.msg(\'保存设置成功\');$("#iszan input").prop("checked", true);$("#iszan .icon-dian").removeClass("hong").addClass("lv");</script>';
						}else{
							echo '<script>x.mclose();x.msg(\'功能已关闭\');$("#iszan input").prop("checked", false);$("#iszan .icon-dian").removeClass("lv").addClass("hong");</script>';
						}
                    }
                    break;
                case 'reply':
                    $data = input('post.');
                    if ($data['rate'] < 1) {
						echo '<script>x.mclose();x.msg(\'评论的频率速度过快，建议最少1分钟\');</script>';
                    } else {
                        $update = [
                            'start' => $data['is'],
                            'rate' => $data['rate'],
                            'xy' => 1,
                            'data' => $data['con'],
                            'nexttime' => time(),
                            'date' => date('m-d H:i:s')
                        ];
                        Qqjob::
                        where('qid', '=', $data['qid'])
                            ->where('type', '=', $act)
                            ->update($update);
                        if ($data['is'] == 1) {
                            echo '<script>x.mclose();x.msg(\'保存设置成功\');$("#isreply input").prop("checked", true);$("#isreply.icon-dian").removeClass("hong").addClass("lv");</script>';
                        } else {
                            echo '<script>x.mclose();x.msg(\'功能已关闭\');$("#isreply input").prop("checked", false);$("#isreply .icon-dian").removeClass("lv").addClass("hong");</script>';
                        }
                    }
                    break;
                case 'mqq':
                    $qid = input('qid');
                    if ($this->userInfo['vipstart'] == '') {
                        echo '<script>x.mclose();
								layer.open({
									content: \'<div><h4 class="mt0 mb5">开启失败</h4></div><div>您需要开通秒赞VIP会员才可以使用该功能!</div>\',
									btn: [\'去 开 通\', \'取 消\'],
									shadeClose: false,
									yes: function(i){
										x.mclose(i);
										mode_shop_vip();
									},
									no: function(i){
										x.mclose(i);
										
									}
								});
								</script>';
                    } else {
                        $row = Qqjob::where('qid', '=', $qid)
                            ->where('type', '=', 'mqq')
                            ->find();
                        if ($row['start'] == 0) {
                            $update = [
                                'start' => 1,
                                'nexttime' => time(),
                                'date' => date('m-d H:i:s')
                            ];
                            Qqjob::
                            where('qid', '=', $qid)
                                ->where('type', '=', 'mqq')
                                ->update($update);
                            echo '<script>x.msg(\'功能已开启\');$("#is'.$act.' input").prop("checked", true);$("#is'.$act.' .icon-dian").removeClass("hong").addClass("lv");</script>';
                        } else {
                            $update = [
                                'start' => 0,
                                'nexttime' => time(),
                                'date' => date('m-d H:i:s')
                            ];
                            Qqjob::
                            where('qid', '=', $qid)
                                ->where('type', '=', 'mqq')
                                ->update($update);
                            echo '<script>x.msg(\'功能已关闭\');$("#is'.$act.' input").prop("checked", false);$("#is'.$act.' .icon-dian").removeClass("lv").addClass("hong");</script>';
                        }
                    }
                    break;
                case 'sy':
                    $qid = input('qid');
                    if ($this->userInfo['vipstart'] == '') {
                       echo '<script>x.mclose();
								layer.open({
									content: \'<div><h4 class="mt0 mb5">开启失败</h4></div><div>您需要开通秒赞VIP会员才可以使用该功能!</div>\',
									btn: [\'去 开 通\', \'取 消\'],
									shadeClose: false,
									yes: function(i){
										x.mclose(i);
										mode_shop_vip();
									},
									no: function(i){
										x.mclose(i);
										
									}
								});
								</script>';
                    } else {
                        $row = Qqjob::where('qid', '=', $qid)
                            ->where('type', '=', 'sy')
                            ->find();
                        if ($row['start'] == 0) {
                            $update = [
                                'start' => 1,
                                'nexttime' => time(),
                                'date' => date('m-d H:i:s')
                            ];
                            Qqjob::
                            where('qid', '=', $qid)
                                ->where('type', '=', 'sy')
                                ->update($update);
                            echo '<script>x.msg(\'功能已开启\');$("#is'.$act.' input").prop("checked", true);$("#is'.$act.' .icon-dian").removeClass("hong").addClass("lv");</script>';
                        } else {
                            $update = [
                                'start' => 0,
                                'nexttime' => time(),
                                'date' => date('m-d H:i:s')
                            ];
                            Qqjob::
                            where('qid', '=', $qid)
                                ->where('type', '=', 'sy')
                                ->update($update);
                            echo '<script>x.msg(\'功能已关闭\');$("#is'.$act.' input").prop("checked", false);$("#is'.$act.' .icon-dian").removeClass("lv").addClass("hong");</script>';
                        }
                    }
                    break;
                case 'qunqd':
                    $data = input('post.');
                    $update = [
                        'start' => $data['is'],
                        'mode' => $data['mode'],
                        'list' => $data['list'],
                        'tuid' => $data['tuid'],
                        'url' => $data['url'],
                        'data' => $data['con'],
                        'nexttime' => time(),
                        'date' => date('m-d H:i:s')
                    ];
                    Qqjob::
                    where('qid', '=', $data['qid'])
                        ->where('type', '=', $act)
                        ->update($update);
							if ($data['is'] == 1) {
                            echo '<script>x.mclose();x.msg(\'保存设置成功\');$("#isqunqd input").prop("checked", true);$("#isqunqd.icon-dian").removeClass("hong").addClass("lv");</script>';
							} else {
                            echo '<script>x.mclose();x.msg(\'功能已关闭\');$("#isqunqd input").prop("checked", false);$("#isqunqd .icon-dian").removeClass("lv").addClass("hong");</script>';
							}
                    break;
				case 'shuo':
                    $data = input('post.');
                    if ($data['rate'] < 10) {
                        echo '<script>x.mclose();x.msg(\'发送频率过快\');';
                    } else {
                        $update = [
                            'start' => $data['is'],
                            'rate' => $data['rate'],
                            'xy' => $data['xy'],
                            'data' => $data['con'],
                            'tuid' => $data['tuid'],
                            'url' => $data['url'],
                            'mode' => $data['mode'],
                            'del' => $data['del'],
                            'nexttime' => time(),
                            'date' => date('m-d H:i:s')
                        ];
                        Qqjob::
                        where('qid', '=', $data['qid'])
                            ->where('type', '=', $act)
                            ->update($update);
                        if ($data['is'] == 1) {
                            echo '<script>x.mclose();x.msg(\'保存设置成功\');$("#isshuo input").prop("checked", true);$("#isshuo.icon-dian").removeClass("hong").addClass("lv");</script>';
                        } else {
                            echo '<script>x.mclose();x.msg(\'功能已关闭\');$("#isshuo input").prop("checked", false);$("#isshuo .icon-dian").removeClass("lv").addClass("hong");</script>';
                        }
                    }
                    break;
                case 'zf':
                    $data = input('post.');
                    if ($this->userInfo['vipstart'] == '') {
                        echo '<script>x.mclose();
								layer.open({
									content: \'<div><h4 class="mt0 mb5">开启失败</h4></div><div>您需要开通秒赞VIP会员才可以使用该功能!</div>\',
									btn: [\'去 开 通\', \'取 消\'],
									shadeClose: false,
									yes: function(i){
										x.mclose(i);
										mode_shop_vip();
									},
									no: function(i){
										x.mclose(i);
										
									}
								});
								</script>';
                    } else {
                        if ($data['rate'] < 10) {
                            echo '<script>x.mclose();x.msg(\'转发频率过快\');';
                        } else {
                            $update = [
                                'start' => $data['is'],
                                'rate' => $data['rate'],
                                'xy' => 0,
                                'data' => $data['con'],
                                'list' => $data['qqlist'],
                                'nexttime' => time(),
                                'date' => date('m-d H:i:s')
                            ];
                            Qqjob::
                            where('qid', '=', $data['qid'])
                                ->where('type', '=', $act)
                                ->update($update);
                            if ($data['is'] == 1) {
                            echo '<script>x.mclose();x.msg(\'保存设置成功\');$("#iszf input").prop("checked", true);$("#iszf.icon-dian").removeClass("hong").addClass("lv");</script>';
							} else {
                            echo '<script>x.mclose();x.msg(\'功能已关闭\');$("#iszf input").prop("checked", false);$("#iszf .icon-dian").removeClass("lv").addClass("hong");</script>';
							}
                        }
                    }
                    break;
                case 'ql':
                    $data = input('post.');
                    if ($this->userInfo['vipstart'] == '') {
                        echo '<script>x.mclose();
								layer.open({
									content: \'<div><h4 class="mt0 mb5">开启失败</h4></div><div>您需要开通秒赞VIP会员才可以使用该功能!</div>\',
									btn: [\'去 开 通\', \'取 消\'],
									shadeClose: false,
									yes: function(i){
										x.mclose(i);
										mode_shop_vip();
									},
									no: function(i){
										x.mclose(i);
										
									}
								});
								</script>';
                    } else {
                        $update = [
                            'start' => $data['is'],
                            'mode' => $data['mode'],
                            'nexttime' => time(),
                            'date' => date('m-d H:i:s')
                        ];
                        Qqjob::
                        where('qid', '=', $data['qid'])
                            ->where('type', '=', $act)
                            ->update($update);
							if ($data['is'] == 1) {
                            echo '<script>x.mclose();x.msg(\'保存设置成功\');$("#isql input").prop("checked", true);$("#isql.icon-dian").removeClass("hong").addClass("lv");</script>';
							} else {
                            echo '<script>x.mclose();x.msg(\'功能已关闭\');$("#isql input").prop("checked", false);$("#isql .icon-dian").removeClass("lv").addClass("hong");</script>';
							}
                    }
                    break;
                case 'del':
                    $qid = input('qid');
                    if ($this->userInfo['vipstart'] == '') {
                        echo '<script>x.mclose();
								layer.open({
									content: \'<div><h4 class="mt0 mb5">开启失败</h4></div><div>您需要开通秒赞VIP会员才可以使用该功能!</div>\',
									btn: [\'去 开 通\', \'取 消\'],
									shadeClose: false,
									yes: function(i){
										x.mclose(i);
										mode_shop_vip();
									},
									no: function(i){
										x.mclose(i);
										
									}
								});
								</script>';
                    } else {
                        $row = Qqjob::where('qid', '=', $qid)
                            ->where('type', '=', 'del')
                            ->find();
                        if ($row['start'] == 0) {
                            $update = [
                                'start' => 1,
                                'nexttime' => time(),
                                'date' => date('m-d H:i:s')
                            ];
                            Qqjob::
                            where('qid', '=', $qid)
                                ->where('type', '=', 'del')
                                ->update($update);
							echo '<script>x.msg(\'功能已开启\');$("#isdel input").prop("checked", true);$("#isdel .icon-dian").removeClass("hong").addClass("lv");</script>';
                        } else {
                            $update = [
                                'start' => 0,
                                'nexttime' => time(),
                                'date' => date('m-d H:i:s')
                            ];
                            Qqjob::
                            where('qid', '=', $qid)
                                ->where('type', '=', 'del')
                                ->update($update);
                            echo '<script>x.msg(\'功能已关闭\');$("#isdel input").prop("checked", false);$("#isdel .icon-dian").removeClass("lv").addClass("hong");</script>';
                        }
                    }
                    break;
                case 'delly':
                    $qid = input('qid');
                    if ($this->userInfo['vipstart'] == '') {
                        echo '<script>x.mclose();
								layer.open({
									content: \'<div><h4 class="mt0 mb5">开启失败</h4></div><div>您需要开通秒赞VIP会员才可以使用该功能!</div>\',
									btn: [\'去 开 通\', \'取 消\'],
									shadeClose: false,
									yes: function(i){
										x.mclose(i);
										mode_shop_vip();
									},
									no: function(i){
										x.mclose(i);
										
									}
								});
								</script>';
                    } else {
                        $row = Qqjob::where('qid', '=', $qid)
                            ->where('type', '=', 'delly')
                            ->find();
                        if ($row['start'] == 0) {
                            $update = [
                                'start' => 1,
                                'nexttime' => time(),
                                'date' => date('m-d H:i:s')
                            ];
                            Qqjob::
                            where('qid', '=', $qid)
                                ->where('type', '=', 'delly')
                                ->update($update);
                            echo '<script>x.msg(\'功能已开启\');$("#is'.$act.' input").prop("checked", true);$("#is'.$act.' .icon-dian").removeClass("hong").addClass("lv");</script>';
                        } else {
                            $update = [
                                'start' => 0,
                                'nexttime' => time(),
                                'date' => date('m-d H:i:s')
                            ];
                            Qqjob::
                            where('qid', '=', $qid)
                                ->where('type', '=', 'delly')
                                ->update($update);
                            echo '<script>x.msg(\'功能已关闭\');$("#is'.$act.' input").prop("checked", false);$("#is'.$act.' .icon-dian").removeClass("lv").addClass("hong");</script>';
                        }
                    }
                    break;
				case 'ht':
                    $qid = input('qid');
                    if ($this->userInfo['vipstart'] == '') {
                        echo '<script>x.mclose();
								layer.open({
									content: \'<div><h4 class="mt0 mb5">开启失败</h4></div><div>您需要开通秒赞VIP会员才可以使用该功能!</div>\',
									btn: [\'去 开 通\', \'取 消\'],
									shadeClose: false,
									yes: function(i){
										x.mclose(i);
										mode_shop_vip();
									},
									no: function(i){
										x.mclose(i);
										
									}
								});
								</script>';
                    } else {
                        $row = Qqjob::where('qid', '=', $qid)
                            ->where('type', '=', $act)
                            ->find();
                        if ($row['start'] == 0) {
                            $update = [
                                'start' => 1,
                                'nexttime' => time(),
                                'date' => date('m-d H:i:s')
                            ];
                            Qqjob::
                            where('qid', '=', $qid)
                                ->where('type', '=', $act)
                                ->update($update);
                            echo '<script>x.msg(\'功能已开启\');$("#is'.$act.' input").prop("checked", true);$("#is'.$act.' .icon-dian").removeClass("hong").addClass("lv");</script>';
                        } else {
                            $update = [
                                'start' => 0,
                                'nexttime' => time(),
                                'date' => date('m-d H:i:s')
                            ];
                            Qqjob::
                            where('qid', '=', $qid)
                                ->where('type', '=', $act)
                                ->update($update);
                            echo '<script>x.msg(\'功能已关闭\');$("#is'.$act.' input").prop("checked", false);$("#is'.$act.' .icon-dian").removeClass("lv").addClass("hong");</script>';
                        }
                    }
                    break;
				case 'qd':
                    $data = input('post.');
                    $update = [
                        'start' => $data['is'],
                        'data' => $data['con'],
                        'nexttime' => time(),
                        'date' => date('m-d H:i:s')
                    ];
                    Qqjob::
                    where('qid', '=', $data['qid'])
                        ->where('type', '=', $act)
                        ->update($update);
							if ($data['is'] == 1) {
                            echo '<script>x.mclose();x.msg(\'保存设置成功\');$("#isqd input").prop("checked", true);$("#isqd.icon-dian").removeClass("hong").addClass("lv");</script>';
							} else {
                            echo '<script>x.mclose();x.msg(\'功能已关闭\');$("#isqd input").prop("checked", false);$("#isqd .icon-dian").removeClass("lv").addClass("hong");</script>';
							}
                    break;
				case 'wsqd':
                    $qid = input('qid');
                    if ($this->userInfo['vipstart'] == '') {
                        echo '<script>x.mclose();
								layer.open({
									content: \'<div><h4 class="mt0 mb5">开启失败</h4></div><div>您需要开通秒赞VIP会员才可以使用该功能!</div>\',
									btn: [\'去 开 通\', \'取 消\'],
									shadeClose: false,
									yes: function(i){
										x.mclose(i);
										mode_shop_vip();
									},
									no: function(i){
										x.mclose(i);
										
									}
								});
								</script>';
                    } else {
                        $row = Qqjob::where('qid', '=', $qid)
                            ->where('type', '=', $act)
                            ->find();
                        if ($row['start'] == 0) {
                            $update = [
                                'start' => 1,
                                'nexttime' => time(),
                                'date' => date('m-d H:i:s')
                            ];
                            Qqjob::
                            where('qid', '=', $qid)
                                ->where('type', '=', $act)
                                ->update($update);
                            echo '<script>x.msg(\'功能已开启\');$("#is'.$act.' input").prop("checked", true);$("#is'.$act.' .icon-dian").removeClass("hong").addClass("lv");</script>';
                        } else {
                            $update = [
                                'start' => 0,
                                'nexttime' => time(),
                                'date' => date('m-d H:i:s')
                            ];
                            Qqjob::
                            where('qid', '=', $qid)
                                ->where('type', '=', $act)
                                ->update($update);
                            echo '<script>x.msg(\'功能已关闭\');$("#is'.$act.' input").prop("checked", false);$("#is'.$act.' .icon-dian").removeClass("lv").addClass("hong");</script>';
                        }
                    }
                    break;
				case 'dhyqd':
                    $qid = input('qid');
                    if ($this->userInfo['vipstart'] == '') {
                        echo '<script>x.mclose();
								layer.open({
									content: \'<div><h4 class="mt0 mb5">开启失败</h4></div><div>您需要开通秒赞VIP会员才可以使用该功能!</div>\',
									btn: [\'去 开 通\', \'取 消\'],
									shadeClose: false,
									yes: function(i){
										x.mclose(i);
										mode_shop_vip();
									},
									no: function(i){
										x.mclose(i);
										
									}
								});
								</script>';
                    } else {
                        $row = Qqjob::where('qid', '=', $qid)
                            ->where('type', '=', $act)
                            ->find();
                        if ($row['start'] == 0) {
                            $update = [
                                'start' => 1,
                                'nexttime' => time(),
                                'date' => date('m-d H:i:s')
                            ];
                            Qqjob::
                            where('qid', '=', $qid)
                                ->where('type', '=', $act)
                                ->update($update);
                            echo '<script>x.msg(\'功能已开启\');$("#is'.$act.' input").prop("checked", true);$("#is'.$act.' .icon-dian").removeClass("hong").addClass("lv");</script>';
                        } else {
                            $update = [
                                'start' => 0,
                                'nexttime' => time(),
                                'date' => date('m-d H:i:s')
                            ];
                            Qqjob::
                            where('qid', '=', $qid)
                                ->where('type', '=', $act)
                                ->update($update);
                            echo '<script>x.msg(\'功能已关闭\');$("#is'.$act.' input").prop("checked", false);$("#is'.$act.' .icon-dian").removeClass("lv").addClass("hong");</script>';
                        }
                    }
                    break;
				case 'renqi':
                    $qid = input('qid');
                    if ($this->userInfo['vipstart'] == '') {
                        echo '<script>x.mclose();
								layer.open({
									content: \'<div><h4 class="mt0 mb5">开启失败</h4></div><div>您需要开通秒赞VIP会员才可以使用该功能!</div>\',
									btn: [\'去 开 通\', \'取 消\'],
									shadeClose: false,
									yes: function(i){
										x.mclose(i);
										mode_shop_vip();
									},
									no: function(i){
										x.mclose(i);
										
									}
								});
								</script>';
                    } else {
                        $row = Qqjob::where('qid', '=', $qid)
                            ->where('type', '=', $act)
                            ->find();
                        if ($row['start'] == 0) {
                            $update = [
                                'start' => 1,
                                'nexttime' => time(),
                                'date' => date('m-d H:i:s')
                            ];
                            Qqjob::
                            where('qid', '=', $qid)
                                ->where('type', '=', $act)
                                ->update($update);
                            echo '<script>x.msg(\'功能已开启\');$("#is'.$act.' input").prop("checked", true);$("#is'.$act.' .icon-dian").removeClass("hong").addClass("lv");</script>';
                        } else {
                            $update = [
                                'start' => 0,
                                'nexttime' => time(),
                                'date' => date('m-d H:i:s')
                            ];
                            Qqjob::
                            where('qid', '=', $qid)
                                ->where('type', '=', $act)
                                ->update($update);
                            echo '<script>x.msg(\'功能已关闭\');$("#is'.$act.' input").prop("checked", false);$("#is'.$act.' .icon-dian").removeClass("lv").addClass("hong");</script>';
                        }
                    }
                    break;
				case 'hyqd':
                    $qid = input('qid');
                    if ($this->userInfo['vipstart'] == '') {
                        echo '<script>x.mclose();
								layer.open({
									content: \'<div><h4 class="mt0 mb5">开启失败</h4></div><div>您需要开通秒赞VIP会员才可以使用该功能!</div>\',
									btn: [\'去 开 通\', \'取 消\'],
									shadeClose: false,
									yes: function(i){
										x.mclose(i);
										mode_shop_vip();
									},
									no: function(i){
										x.mclose(i);
										
									}
								});
								</script>';
                    } else {
                        $row = Qqjob::where('qid', '=', $qid)
                            ->where('type', '=', $act)
                            ->find();
                        if ($row['start'] == 0) {
                            $update = [
                                'start' => 1,
                                'nexttime' => time(),
                                'date' => date('m-d H:i:s')
                            ];
                            Qqjob::
                            where('qid', '=', $qid)
                                ->where('type', '=', $act)
                                ->update($update);
                            echo '<script>x.msg(\'功能已开启\');$("#is'.$act.' input").prop("checked", true);$("#is'.$act.' .icon-dian").removeClass("hong").addClass("lv");</script>';
                        } else {
                            $update = [
                                'start' => 0,
                                'nexttime' => time(),
                                'date' => date('m-d H:i:s')
                            ];
                            Qqjob::
                            where('qid', '=', $qid)
                                ->where('type', '=', $act)
                                ->update($update);
                            echo '<script>x.msg(\'功能已关闭\');$("#is'.$act.' input").prop("checked", false);$("#is'.$act.' .icon-dian").removeClass("lv").addClass("hong");</script>';
                        }
                    }
                    break;
				case 'hzqd':
                    $qid = input('qid');
                    if ($this->userInfo['vipstart'] == '') {
                        echo '<script>x.mclose();
								layer.open({
									content: \'<div><h4 class="mt0 mb5">开启失败</h4></div><div>您需要开通秒赞VIP会员才可以使用该功能!</div>\',
									btn: [\'去 开 通\', \'取 消\'],
									shadeClose: false,
									yes: function(i){
										x.mclose(i);
										mode_shop_vip();
									},
									no: function(i){
										x.mclose(i);
										
									}
								});
								</script>';
                    } else {
                        $row = Qqjob::where('qid', '=', $qid)
                            ->where('type', '=', $act)
                            ->find();
                        if ($row['start'] == 0) {
                            $update = [
                                'start' => 1,
                                'nexttime' => time(),
                                'date' => date('m-d H:i:s')
                            ];
                            Qqjob::
                            where('qid', '=', $qid)
                                ->where('type', '=', $act)
                                ->update($update);
                            echo '<script>x.msg(\'功能已开启\');$("#is'.$act.' input").prop("checked", true);$("#is'.$act.' .icon-dian").removeClass("hong").addClass("lv");</script>';
                        } else {
                            $update = [
                                'start' => 0,
                                'nexttime' => time(),
                                'date' => date('m-d H:i:s')
                            ];
                            Qqjob::
                            where('qid', '=', $qid)
                                ->where('type', '=', $act)
                                ->update($update);
                            echo '<script>x.msg(\'功能已关闭\');$("#is'.$act.' input").prop("checked", false);$("#is'.$act.' .icon-dian").removeClass("lv").addClass("hong");</script>';
                        }
                    }
                    break;
				case 'hlwqd':
                    $qid = input('qid');
                    if ($this->userInfo['vipstart'] == '') {
                        echo '<script>x.mclose();
								layer.open({
									content: \'<div><h4 class="mt0 mb5">开启失败</h4></div><div>您需要开通秒赞VIP会员才可以使用该功能!</div>\',
									btn: [\'去 开 通\', \'取 消\'],
									shadeClose: false,
									yes: function(i){
										x.mclose(i);
										mode_shop_vip();
									},
									no: function(i){
										x.mclose(i);
										
									}
								});
								</script>';
                    } else {
                        $row = Qqjob::where('qid', '=', $qid)
                            ->where('type', '=', $act)
                            ->find();
                        if ($row['start'] == 0) {
                            $update = [
                                'start' => 1,
                                'nexttime' => time(),
                                'date' => date('m-d H:i:s')
                            ];
                            Qqjob::
                            where('qid', '=', $qid)
                                ->where('type', '=', $act)
                                ->update($update);
                            echo '<script>x.msg(\'功能已开启\');$("#is'.$act.' input").prop("checked", true);$("#is'.$act.' .icon-dian").removeClass("hong").addClass("lv");</script>';
                        } else {
                            $update = [
                                'start' => 0,
                                'nexttime' => time(),
                                'date' => date('m-d H:i:s')
                            ];
                            Qqjob::
                            where('qid', '=', $qid)
                                ->where('type', '=', $act)
                                ->update($update);
                            echo '<script>x.msg(\'功能已关闭\');$("#is'.$act.' input").prop("checked", false);$("#is'.$act.' .icon-dian").removeClass("lv").addClass("hong");</script>';
                        }
                    }
                    break;
				case 'wyqd':
                    $qid = input('qid');
                    if ($this->userInfo['vipstart'] == '') {
                        echo '<script>x.mclose();
								layer.open({
									content: \'<div><h4 class="mt0 mb5">开启失败</h4></div><div>您需要开通秒赞VIP会员才可以使用该功能!</div>\',
									btn: [\'去 开 通\', \'取 消\'],
									shadeClose: false,
									yes: function(i){
										x.mclose(i);
										mode_shop_vip();
									},
									no: function(i){
										x.mclose(i);
										
									}
								});
								</script>';
                    } else {
                        $data = input('post.');
						$update = [
							'start' => $data['is'],
							'list' => $data['username'],
							'data' => $data['password'],
							'nexttime' => time(),
							'date' => date('m-d H:i:s')
						];
						Qqjob::
						where('qid', '=', $data['qid'])
							->where('type', '=', $act)
							->update($update);
						if ($data['is'] == 1) {
							echo '<script>x.mclose();x.msg(\'保存设置成功\');$("#is'.$act.' input").prop("checked", true);$("#is'.$act.'.icon-dian").removeClass("hong").addClass("lv");</script>';
						} else {
							echo '<script>x.mclose();x.msg(\'功能已关闭\');$("#is'.$act.' input").prop("checked", false);$("#is'.$act.' .icon-dian").removeClass("lv").addClass("hong");</script>';
						}
                    }
                    break;
				case 'yundong':
                    $qid = input('qid');
                    if ($this->userInfo['vipstart'] == '') {
                        echo '<script>x.mclose();
								layer.open({
									content: \'<div><h4 class="mt0 mb5">开启失败</h4></div><div>您需要开通秒赞VIP会员才可以使用该功能!</div>\',
									btn: [\'去 开 通\', \'取 消\'],
									shadeClose: false,
									yes: function(i){
										x.mclose(i);
										mode_shop_vip();
									},
									no: function(i){
										x.mclose(i);
										
									}
								});
								</script>';
                    } else {
                        $row = Qqjob::where('qid', '=', $qid)
                            ->where('type', '=', $act)
                            ->find();
                        if ($row['start'] == 0) {
                            $update = [
                                'start' => 1,
                                'nexttime' => time(),
                                'date' => date('m-d H:i:s')
                            ];
                            Qqjob::
                            where('qid', '=', $qid)
                                ->where('type', '=', $act)
                                ->update($update);
                            echo '<script>x.msg(\'功能已开启\');$("#is'.$act.' input").prop("checked", true);$("#is'.$act.' .icon-dian").removeClass("hong").addClass("lv");</script>';
                        } else {
                            $update = [
                                'start' => 0,
                                'nexttime' => time(),
                                'date' => date('m-d H:i:s')
                            ];
                            Qqjob::
                            where('qid', '=', $qid)
                                ->where('type', '=', $act)
                                ->update($update);
                            echo '<script>x.msg(\'功能已关闭\');$("#is'.$act.' input").prop("checked", false);$("#is'.$act.' .icon-dian").removeClass("lv").addClass("hong");</script>';
                        }
                    }
                    break;
				case 'hzmp':
                    $qid = input('qid');
                    if ($this->userInfo['vipstart'] == '') {
                        echo '<script>x.mclose();
								layer.open({
									content: \'<div><h4 class="mt0 mb5">开启失败</h4></div><div>您需要开通秒赞VIP会员才可以使用该功能!</div>\',
									btn: [\'去 开 通\', \'取 消\'],
									shadeClose: false,
									yes: function(i){
										x.mclose(i);
										mode_shop_vip();
									},
									no: function(i){
										x.mclose(i);
										
									}
								});
								</script>';
                    } else {
                        $row = Qqjob::where('qid', '=', $qid)
                            ->where('type', '=', $act)
                            ->find();
                        if ($row['start'] == 0) {
                            $update = [
                                'start' => 1,
                                'nexttime' => time(),
                                'date' => date('m-d H:i:s')
                            ];
                            Qqjob::
                            where('qid', '=', $qid)
                                ->where('type', '=', $act)
                                ->update($update);
                            echo '<script>x.msg(\'功能已开启\');$("#is'.$act.' input").prop("checked", true);$("#is'.$act.' .icon-dian").removeClass("hong").addClass("lv");</script>';
                        } else {
                            $update = [
                                'start' => 0,
                                'nexttime' => time(),
                                'date' => date('m-d H:i:s')
                            ];
                            Qqjob::
                            where('qid', '=', $qid)
                                ->where('type', '=', $act)
                                ->update($update);
                            echo '<script>x.msg(\'功能已关闭\');$("#is'.$act.' input").prop("checked", false);$("#is'.$act.' .icon-dian").removeClass("lv").addClass("hong");</script>';
                        }
                    }
                    break;
            }
        }
    }

    protected
    function _initialize()
    {
        parent::_initialize();
        $this->checkLogin();
		
    }
	
	private
    function checkLogin()
    {
        $check_Login = Users::checkLogin();
        if ($check_Login != null) {
            $this->assign('alert', $check_Login['msg']);
            $this->assign('url', $check_Login['url']);
            exit($this->fetch('pc/common/msg'));
        } else {
            $this->userInfo = Users::getLoginUser();
            $this->assign('userInfo', $this->userInfo);

        }
    }
}